<template>
    <img :src="fullSrc" v-bind="$attrs" class="image-box">
</template>

<script setup lang="ts">
import { computed } from 'vue'

defineOptions({
    name: 'ImageBox'
})

const props = defineProps({
    src: {
        type: String,
        default: ''
    }
})

// https://acme.r2.hyw01.xyz/ 为动态的，后面会改成虫接口拿
const fullSrc = computed(() => {
    if(props.src.startsWith('http')){
        return props.src
    }else{
        return 'https://acme.r2.hyw01.xyz/' + props.src
    }
})
</script>

<style scoped>
.image-box {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
</style>
